import React, { Component } from 'react'
import { Consumer } from '../utils/context'

export default class ComponentB extends Component {
    render() {
        return (<Consumer>
            {
                ({name, changeTitle}) => {
                    return <div>
                        我是子组件b
                        <h1>接收 {name} 传来的参数</h1>
                        <button onClick={() => changeTitle('孙子')}>修改祖宗的数据</button>
                    </div>
                }
            }
        </Consumer>

        )
    }
}
